public class RefHisto extends BaseHisto
{
    // Fill in 'hist' with the data from 'input'
    //
    def histogram(hist: Array[int]{rank==2}, input: Array[int]{rank==1})
    {
        // Zero out the histogram
        for (i in hist)
            hist(i) = 0;


        // Fill the histogram 
        for (i in input)
        {
            val value: int = input(i);
            val y: Int = (value / (hist.region.max(WIDTH_AXIS)+1)) & hist.region.max(HEIGHT_AXIS);
            val x: Int = (value & hist.region.max(WIDTH_AXIS));

            hist(y, x) += 1;
        }
    }

    public def getName() : String
    {
        return "Single Threaded/idiomatic";
    }
}
